如何使用selenium c#检测网页上的验证码? 您所在的位置:网站首页 selenium 登录 验证码 如何使用selenium c#检测网页上的验证码?

如何使用selenium c#检测网页上的验证码?

2023-04-01 08:55| 来源: 网络整理| 查看: 265

我使用selenium c#创建了一个有趣的小机器人,它在一个名为omegle.com的网站上播放tic tac toe,运行良好,但它总是被验证码阻止

那么如何检查页面上是否存在验证码呢?

(注:我没有说绕过)

我尝试过By.XPath("...")和By.ClassName("..."),但过了一段时间就停止工作了(可能是因为XPath发生了变化)

到目前为止,我做到了以下几点:

public int captcha() //detects captcha , 1= solved { try //checks if captcha is on page and asks user to solve it { IWebElement temp=driver.FindElement(By.______("...")); Console.WriteLine(temp.Text); } catch { goto end; } //if captcha is not on the page Console.WriteLine("CAPTCHA DETECTED! Solve captcha to proceed!"); while(true) { try //keeps checking if captcha is still on page { driver.FindElement(By.____("...")); } catch { break; } //breaks out of loop if captcha is solved } Console.WriteLine("Captcha Solved!"); end:; return 1; }

下面是iframe标签:



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有